<html>
<head><meta charset="utf-8"><title>rust-analyzer and rustc · t-compiler/rust-analyzer · Zulip Chat Archive</title></head>
<h2>Stream: <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/index.html">t-compiler/rust-analyzer</a></h2>
<h3>Topic: <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/rust-analyzer.20and.20rustc.html">rust-analyzer and rustc</a></h3>

<hr>

<base href="https://rust-lang.zulipchat.com">

<head><link href="https://rust-lang.github.io/zulip_archive/style.css" rel="stylesheet"></head>

<a name="192314720"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/rust-analyzer%20and%20rustc/near/192314720" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/rust-analyzer.20and.20rustc.html#192314720">(Mar 30 2020 at 20:42)</a>:</h4>
<p>Hey, so, when I open rustc in rust-analyzer, I get a bunch of entries in the "problem" section that I think come from running <code>cargo check</code> and not <code>x.py check</code> -- is there a way to customize the command rust-analyzer uses? Also, is this written up? Should I RTFM?</p>



<a name="192317914"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/rust-analyzer%20and%20rustc/near/192317914" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> std::Veetaha <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/rust-analyzer.20and.20rustc.html#192317914">(Mar 30 2020 at 21:11)</a>:</h4>
<p><span class="user-mention" data-user-id="116009">@nikomatsakis</span> eh, unfortunately, I guess we lack the docs for this one in the repo itself.<br>
Actually, the best way to inspect what's available in the configs is by hitting  <code>Ctrl+Space</code> in <code>settings.json</code> file:<br>
<a href="/user_uploads/4715/4dfZse5vyWdzkDsV356Efxrs/command.gif" title="command.gif">command.gif</a></p>
<div class="message_inline_image"><a href="/user_uploads/4715/4dfZse5vyWdzkDsV356Efxrs/command.gif" title="command.gif"><img src="/user_uploads/4715/4dfZse5vyWdzkDsV356Efxrs/command.gif"></a></div><p>or <del>(the non-cool)</del> method is using the vscode settings UI<br>
<a href="/user_uploads/4715/bkuO8p21Nu8U3dFBNSZrH3SI/image.png" title="image.png">image.png</a></p>
<div class="message_inline_image"><a href="/user_uploads/4715/bkuO8p21Nu8U3dFBNSZrH3SI/image.png" title="image.png"><img src="/user_uploads/4715/bkuO8p21Nu8U3dFBNSZrH3SI/image.png"></a></div>



<a name="192318104"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/rust-analyzer%20and%20rustc/near/192318104" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> std::Veetaha <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/rust-analyzer.20and.20rustc.html#192318104">(Mar 30 2020 at 21:13)</a>:</h4>
<p>Idk what <code>x.py check</code> means, I doubt that we will be able to watch that command, we are hardcoding the <code>cargo</code> executable right now. Maybe we should generalize this more. The main concern is that the command that is watched has to produce <code>stdout</code> output compatible with <code>cargo metadata</code> protocol.<br>
P.S.<br>
I know you are new vscode, just as a reminder, there is a global <code>settings.json</code> file that you can assess via <code>Ctrl+Shift+P</code> (command palette)  and <code>Preferences: Open Settings (JSON)</code>.<br>
But if you need project-specific overrides, just create <code>.vscode/settings.json</code> in the root of the folder opened in vscode.</p>



<a name="192318841"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/rust-analyzer%20and%20rustc/near/192318841" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> std::Veetaha <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/rust-analyzer.20and.20rustc.html#192318841">(Mar 30 2020 at 21:21)</a>:</h4>
<p>Right now I think the _workaround_ would be to create a cargo alias that runs this <code>x.py</code> under the hood and then passing the alias name as <code>rust-analyzer.cargo-watch.command</code></p>



<a name="192320758"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/rust-analyzer%20and%20rustc/near/192320758" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/rust-analyzer.20and.20rustc.html#192320758">(Mar 30 2020 at 21:39)</a>:</h4>
<p>hmm, I see, I could make like <code>cargo build-rustc</code> or something</p>



<a name="192320788"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/rust-analyzer%20and%20rustc/near/192320788" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/rust-analyzer.20and.20rustc.html#192320788">(Mar 30 2020 at 21:39)</a>:</h4>
<p>and set rust-analyzer.cargo-watch command</p>



<a name="192322043"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/rust-analyzer%20and%20rustc/near/192322043" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/rust-analyzer.20and.20rustc.html#192322043">(Mar 30 2020 at 21:51)</a>:</h4>
<p>that doesn't quite seem to work for me but .. not sure why</p>



<a name="192322064"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/rust-analyzer%20and%20rustc/near/192322064" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/rust-analyzer.20and.20rustc.html#192322064">(Mar 30 2020 at 21:51)</a>:</h4>
<p>could be related to the errors I am getting around "watching" having problems because of needing more file descriptors or something</p>



<a name="192322119"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/rust-analyzer%20and%20rustc/near/192322119" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/rust-analyzer.20and.20rustc.html#192322119">(Mar 30 2020 at 21:52)</a>:</h4>
<p>(specifically, I just get "no output" from the Problems section)</p>



<a name="192322139"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/rust-analyzer%20and%20rustc/near/192322139" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/rust-analyzer.20and.20rustc.html#192322139">(Mar 30 2020 at 21:52)</a>:</h4>
<p>is there some way to see the "cargo watch" output?</p>



<a name="192322419"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/rust-analyzer%20and%20rustc/near/192322419" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> std::Veetaha <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/rust-analyzer.20and.20rustc.html#192322419">(Mar 30 2020 at 21:55)</a>:</h4>
<p>Unfortunately, we don't log the output itself (due to the compexity around reading both <code>stdout</code> and <code>stderr</code> simultaneously (i.e. <a href="https://github.com/rust-lang/rust/blob/f4c675c476c18b1a11041193f2f59d695b126bc8/src/tools/compiletest/src/read2.rs" title="https://github.com/rust-lang/rust/blob/f4c675c476c18b1a11041193f2f59d695b126bc8/src/tools/compiletest/src/read2.rs">this bit of your code</a>)),  but we log the command that is run if it ends with an error in <code>Rust Analyzer Language Server</code> output.<br>
<a href="/user_uploads/4715/jkJAvElDv92Ln4BUySyw3Hfb/image.png" title="image.png">image.png</a>.</p>
<div class="message_inline_image"><a href="/user_uploads/4715/jkJAvElDv92Ln4BUySyw3Hfb/image.png" title="image.png"><img src="/user_uploads/4715/jkJAvElDv92Ln4BUySyw3Hfb/image.png"></a></div>



<a name="192322698"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/rust-analyzer%20and%20rustc/near/192322698" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/rust-analyzer.20and.20rustc.html#192322698">(Mar 30 2020 at 21:58)</a>:</h4>
<p>that helps, thanks</p>



<a name="192322771"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/rust-analyzer%20and%20rustc/near/192322771" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/rust-analyzer.20and.20rustc.html#192322771">(Mar 30 2020 at 21:59)</a>:</h4>
<div class="codehilite"><pre><span></span>[ERROR ra_cargo_watch] Cargo watcher failed CargoError(&quot;the command produced no valid metadata (exit code: ExitStatus(ExitStatus(256))): cargo build-rustc --workspace --message-format=json --manifest-path /home/nmatsakis/versioned/rust-3/Cargo.toml --all-targets&quot;)
</pre></div>



<a name="192322780"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/rust-analyzer%20and%20rustc/near/192322780" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/rust-analyzer.20and.20rustc.html#192322780">(Mar 30 2020 at 21:59)</a>:</h4>
<p>I'll have to see if I can get the metadata output correct</p>



<a name="192422126"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/rust-analyzer%20and%20rustc/near/192422126" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> matklad <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/rust-analyzer.20and.20rustc.html#192422126">(Mar 31 2020 at 17:27)</a>:</h4>
<blockquote>
<p>is there a way to customize the command rust-analyzer uses?</p>
</blockquote>
<p>Not, yet, we unfortunatelly at the moment only allow to override the name of the cargo command.  I've wanted to add a hook to override everything for ages, started working on this today.</p>



<hr><p>Last updated: Aug 07 2021 at 22:04 UTC</p>
</html>